#include "Fighter.h"

Fighter::Fighter()
{
}

Fighter::~Fighter()
{
}

void Fighter::Load()
{
	mSprite.Load("Fighter.png");
}

void Fighter::Unload()
{
	mSprite.Unload();
}

void Fighter::Update(float deltaTime)
{
	const float kSpeed = 100.0f; 

	if(Input_IsKeyDown(Keys::RIGHT))
	{
		mPosition.x += kSpeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::LEFT))
	{
		mPosition.x -= kSpeed * deltaTime;
	}

	if(Input_IsKeyDown(Keys::UP))
	{
		mPosition.y -= kSpeed * deltaTime;
	}
	else if(Input_IsKeyDown(Keys::DOWN))
	{
		mPosition.y += kSpeed * deltaTime;
	}
}

void Fighter::Render()
{
	//offset to make up for off position, move from corner to the center
	int width = mSprite.GetWidth();
	int height = mSprite.GetHeight();

	SVector2 offset(width * 0.5f, height * 0.5f);
	SVector2 renderPosition = mPosition - offset;

	mSprite.SetPosition(renderPosition);

	mSprite.Render();
}
